package com.spareparts.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.spareparts.R;
import com.spareparts.activity.base.BaseActivity;
import com.spareparts.util.Content;

public class NavigationActivity extends BaseActivity 
{
	private ImageView tvCK;
	private ImageView tvRK;
	private ImageView tvWX;
	private ImageView tvBF;
	private ImageView tvPD;
	private ImageView tvSS;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_navigation);
		
		tvRK = (ImageView) findViewById(R.id.imageViewRK);
		tvCK = (ImageView) findViewById(R.id.imageViewCK);
		tvWX = (ImageView) findViewById(R.id.imageViewWX);
		tvBF = (ImageView) findViewById(R.id.imageViewBF);
		tvPD = (ImageView) findViewById(R.id.imageViewPD);
		tvSS = (ImageView) findViewById(R.id.imageViewSS);
		
		setOnClickListener();
	}
	
	private void setIntent(int type)
	{
		Intent intent = new Intent();
		intent.setClass(NavigationActivity.this, WareHouseStorageActivity.class);
		intent.putExtra("type", type);
		intent.putExtra("main", "isMain");
		startActivity(intent);
	}
	
	/**
	 * 设置图标单击事件
	 */
	private void setOnClickListener()
	{
		
		tvCK.setOnClickListener(new OnClickListener() 
		{
			@Override
			public void onClick(View v) 
			{
				setIntent(Content.lIBRARY_CLICK);
			}
		});
		
		tvRK.setOnClickListener(new OnClickListener() 
		{
			@Override
			public void onClick(View v) 
			{
				setIntent(Content.STORAGE_CLICK);
			}
		});
		
		tvWX.setOnClickListener(new OnClickListener() 
		{
			@Override
			public void onClick(View v) 
			{
				setIntent(Content.REPAIR_CHANGE_CLICK);
			}
		});
		
		tvBF.setOnClickListener(new OnClickListener() 
		{
			@Override
			public void onClick(View v) 
			{
				setIntent(Content.SCRAP_CLICK);
			}
		});
		
		tvPD.setOnClickListener(new OnClickListener() 
		{
			@Override
			public void onClick(View v) 
			{
				setIntent(Content.INVENTORY_CLICK);
			}
		});
		
		tvSS.setOnClickListener(new OnClickListener() 
		{
			@Override
			public void onClick(View v) 
			{
				Intent intent = new Intent();
				intent.setClass(NavigationActivity.this, SearchActivity.class);
				startActivity(intent);
			}
		});
	}
}
